from tkinter import *
from config import *
from sql import sqlseverDB
from mini_tools.cjjtool import *
from mini_tools.myexcel import *
from mini_tools.mytools import *
#from my_frame.updown import DataGLFra
#from my_frame.admin2 import Admin2Fra
from my_frame.DeepSeekQK import DeepSeekFra
from my_frame.amazon import QKCJ
from my_frame.shopeeatc import ShopeeATC
from my_frame.shoppeQK import ShopeeQKCJ1
from my_frame.shopeety import ShopeeQKCJ2
from my_frame.shopeeCom import ShopeeQKCZ1
from my_frame.othertask import OtherTask


class GnnFrame(Frame):
    def __init__(self,master=None):
        Frame.__init__(self,master)
        self.ms = sqlseverDB('{SQL Server}', SQL_SERVER, 'SuMaiTongPol', SQL_USER, SQL_PWD)
        self.rowCount=IntVar()
        self.createWidgets()

    def createWidgets(self):

        self.rbtnFra=Frame(self,width=800)
        self.rbtnFra.pack(pady=5)
        self.v = IntVar()
        self.v.set(1)
        self.lfras=[QKCJ(self),ShopeeATC(self),ShopeeQKCJ1(self),ShopeeQKCJ2(self),
                    ShopeeQKCZ1(self),DeepSeekFra(self),OtherTask(self)
                    ]

    def changesr(self):

        j=1
        for fra in self.lfras:
            if j==self.v.get():
                fra.pack(fill=X)
            else:
                fra.pack_forget()
            j+=1

    
    def cgpb(self,utype):
        rbtnFra=self.rbtnFra
        if utype==1:
            #Radiobutton(rbtnFra, text="数据管理", variable=self.v, value=1,command=self.changesr).grid(row=1,column=1,padx=3)
            #Radiobutton(rbtnFra, text="管理员功能", variable=self.v, value=2,command=self.changesr).grid(row=1,column=2,padx=3)
            Radiobutton(rbtnFra, text="采集功能", variable=self.v, value=1,command=self.changesr).grid(row=1,column=1,padx=3)
            Radiobutton(rbtnFra, text="虾皮大数据筛选", variable=self.v, value=2,command=self.changesr).grid(row=1,column=2,padx=3)
            Radiobutton(rbtnFra, text="虾皮任务(采集)", variable=self.v, value=3,command=self.changesr).grid(row=1,column=3,padx=3)
            Radiobutton(rbtnFra, text="虾皮任务(采集2)", variable=self.v, value=4,command=self.changesr).grid(row=1,column=4,padx=3)
            Radiobutton(rbtnFra, text="虾皮任务(操作)", variable=self.v, value=5,command=self.changesr).grid(row=1,column=5,padx=3)
            Radiobutton(rbtnFra, text="DeepSeek", variable=self.v, value=6,command=self.changesr).grid(row=1,column=6,padx=3)
            Radiobutton(rbtnFra, text="其他任务", variable=self.v, value=7,command=self.changesr).grid(row=2,column=1,padx=3)
        
        elif utype==2:
            self.v.set(5)
            Radiobutton(rbtnFra, text="小工具", variable=self.v, value=3,command=self.changesr).grid(row=0,column=3,padx=3)

        elif utype==3:
            self.v.set(3)
            Radiobutton(rbtnFra, text="小工具", variable=self.v, value=3,command=self.changesr).grid(row=0,column=2,padx=3)

        
        elif utype==4:
            self.v.set(3)
            Radiobutton(rbtnFra, text="小工具", variable=self.v, value=3,command=self.changesr).grid(row=0,column=3,padx=3)

        
        elif utype==5:
            self.v.set(3)
            Radiobutton(rbtnFra, text="小工具", variable=self.v, value=3,command=self.changesr).grid(row=0,column=2,padx=3)
        
        elif utype==6:
            self.v.set(3)
            Radiobutton(rbtnFra, text="小工具", variable=self.v, value=3,command=self.changesr).grid(row=0,column=2,padx=3)

        elif utype==7:
            self.v.set(3)
            Radiobutton(rbtnFra, text="小工具", variable=self.v, value=3,command=self.changesr).grid(row=0,column=3,padx=3)


        self.changesr()


# import tkinter
# list_win=tkinter.Tk()
# list_win.wm_geometry("800x650")
# list_win.title('allgero')
# DataFra9(list_win).pack(fill=X,padx=3,pady=3)
# list_win.mainloop()